import React, { Component } from 'react';
import ReactDOM from 'react-dom';

class UnControl extends Component {
    password = React.createRef()
    handleClick = () => {
        console.log(this.username)
        console.log(this.password.current)
    }
    render() {
        return (<div>
            <input type='text' defaultValue = 'saber' name='username' ref = {dom => {this.username = dom}}/>
            <input type='text' defaultValue = '******' name='password' ref = {this.password}/>
            <button onClick = {this.handleClick}>click me</button>
        </div>);
    }
}

ReactDOM.render(<UnControl/>, window.root)

export default UnControl;